# # 文件打开open(),encoding=utf-8
# # open()打开得到的是一个文件对象
# # 读取文件内容
# f = open('111.txt', 'r', encoding="utf-8")
# print(f)
# # 使用with open读取文件
# with open('111.txt', 'r', encoding="utf-8") as file:
#     text = file.read()
# print(text)
#
# # 写文件write()
# a = 'world'
# b = 'red'
# f1 = open('222.txt', 'w', encoding='utf-8')
# f1.write(a)
# f1.close()
#
# # 打开文件用于写入，如果文件不存在将会被创建
# with open('222.txt', 'a', encoding='utf-8') as file:
#     file.write(b)